// HSS.Forms.Docking.DockWindowCollection.cs
// ----------------------------------------------------------------------------
// Licensed under the MIT license
// http://www.opensource.org/licenses/mit-license.html
// ----------------------------------------------------------------------------
// HighSpeed-Solutions, LLC
// Copyright (c) 2001-2010
// ----------------------------------------------------------------------------
// File:       DockWindowCollection.cs
// Author:     HSS\gbanta
// Created:    08/12/2010
// Modified:   12/04/2010
// ----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace HSS.Forms.Docking
{
	#region DockWindowCollection
	/// <summary>
	/// DockWindowCollection
	/// </summary>
	public class DockWindowCollection : ReadOnlyCollection<DockWindow>
	{
		#region Constructor
		/// <summary>
		/// ctor
		/// </summary>
		/// <param name="dockPanel">DockPanel</param>
		internal DockWindowCollection(DockPanel dockPanel)
            : base(new List<DockWindow>())
		{
			Items.Add(new DockWindow(dockPanel, DockState.Document));
			Items.Add(new DockWindow(dockPanel, DockState.DockLeft));
			Items.Add(new DockWindow(dockPanel, DockState.DockRight));
			Items.Add(new DockWindow(dockPanel, DockState.DockTop));
			Items.Add(new DockWindow(dockPanel, DockState.DockBottom));
		}
		#endregion

		/// <summary>
		/// Index
		/// </summary>
		/// <param name="dockState">DockState</param>
		/// <returns>DockWindow</returns>
		public DockWindow this [DockState dockState]
		{
			get
			{
				if (dockState == DockState.Document)
					return Items[0];
				else if (dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide)
					return Items[1];
				else if (dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide)
					return Items[2];
				else if (dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide)
					return Items[3];
				else if (dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide)
					return Items[4];

				throw (new ArgumentOutOfRangeException());
			}
		}
	}
	#endregion
}